package com.micro.center.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.micro.center.entity.SysDictEntity;
import com.micro.center.mapper.SysDictMapper;
import com.micro.common.constant.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author pan.shun
 * @version 2.0
 * @since 2022/7/13 19:55
 */
@Slf4j
@Service
public class SysDictService extends ServiceImpl<SysDictMapper, SysDictEntity> {

    public R getDictByCode(String dictCode, String appId) {
        LambdaQueryWrapper<SysDictEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysDictEntity::getDictCode, dictCode);
        queryWrapper.eq(SysDictEntity::getAppId, appId);
        List<SysDictEntity> list = this.list(queryWrapper);
        return R.success(list);
    }
}
